
library(RColorBrewer)

data <- data.frame(
  Year = c(2018, 2020, 2021, 2021, 2021, 2021, 2021, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023),
  Journal = c("Journal of Technology in Human Services", "Data Mining and Knowledge Discovery", "Frontiers in Artificial Intelligence", "Journal of Risk and Financial Management", "Knowledge-Based Systems", "Minds and Machines", "Oxford Review of Economic Policy", "Applied Sciences", "Data Mining and Knowledge Discovery", "European Journal of Operational Research", "Expert Systems with Applications", "IEEE Access", "Journal of Data and Information Quality", "Journal of Risk and Financial Management", "Machine Learning and Knowledge Extraction", "Pattern Recognition Letters", "Risks", "AI and Ethics", "AI Open", "Information Sciences", "International Journal of Human–Computer Interaction", "Knowledge-Based Systems", "Neurocomputing", "Pattern Recognition Letters", "Expert Systems with Applications"),
  Publications = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1)
)

# Create a bar plot

grafico <- ggplot(data, aes(x = Year, y = Publications, fill = Journal)) +
  geom_bar(stat = "identity") +
  theme(axis.text.x = element_text(angle = 90, hjust = 1),
        axis.title.x = element_text(color = "black", size = 14, face = "bold"),
        axis.title.y = element_text(color = "black", size = 14, face = "bold")) +
  scale_x_continuous(breaks = min(data$Year):max(data$Year)) +
  scale_y_continuous(breaks = 0:10) +
  xlab("Ano de Publicação") +
  ylab("Número de Publicações") +
  labs(fill = "Revista")


ggsave("Artigos_revistas.png", arrangeGrob(grafico), width = 16, height = 8, dpi = 300)
